<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8">
<title>查看房源信息详情</title>
<link rel="stylesheet" href="/css/bootstrap.min.css">
<script src="/js/jquery/jquery.min.js"></script>
<script src="/js/jquery.validation/1.14.0/jquery.validate.min.js"></script>
<script src="/js/jquery.validation/1.14.0/messages_zh.min.js"></script>
<style>
input.error {
	border: 1px solid #E6594E;
}
</style>

</head>
<body>
	<div class="container">
			<div class="form-group">
				<label for="title">房源信息标题：</label> <input type="text"
					class="form-control" id="title"  value="${hdetails.title}" readonly="true"> 
			</div>

			<div class="form-group">
				<label for="price">房源所在区域：</label> <input type="text"
					class="form-control" id="price" 
					value="${hdetails.dname}" readonly="true">
			</div>
			<div class="form-group">
				<label for="price">房源所处街道：</label> <input type="text"
					class="form-control" id="price" 
					value="${hdetails.sname}" readonly="true">
			</div>
			<div class="form-group">
				<label for="price">房源房型：</label> <input type="text"
					class="form-control" id="price" 
					value="${hdetails.tname}" readonly="true">
			</div>
			<div class="form-group">
				<label for="price">房源月租金：</label> <input type="text"
					class="form-control" id="price" 
					value="${hdetails.price}" readonly="true">
			</div>
			<div class="form-group">
				<label for="floorage">房源面积：</label> <input type="text"
					class="form-control" id="floorage" 
					value="${hdetails.floorage}" readonly="true">
			</div>
			<div class="form-group">
				<label for="contact">房源户主联系方式：</label> <input type="text"
					class="form-control" id="contact" 
					value="${hdetails.contact}" readonly="true">
			</div>

			<div class="form-group">
				<label for="describtion">房源详细信息</label>
				<textarea class="form-control" rows="3" id="description" readonly="true">${hdetails.description}</textarea>
			</div>

		</form>
	</div>
	<script>
		var editHouse = function() {
			$.ajax({
				type : "GET",
				dataType : "json",
				url : "/house/update.do",
				data : {
					"id" : $("#hid").val(),
					"title" : $("#title").val(),
					"contact" : $("#contact").val(),
					"price" : $("#price").val(),
					"description" : $("#description").val(),
					"floorage" : $("#floorage").val(),
					"street_id" : $("#street_id").val(),
					"type_id" : $("#type_id").val()
				},
				success : function(msg) {
					$('#cancelBtn').click();
				},
			});
		}
		$('#saveBtn').on('click', function() {
			editHouse();
		});
		$('#cancelBtn').on('click', function() {
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
		});
		
	</script>
</body>
</html>